<!-- 知识库 -->
<template>
    <div class="MyKnowledge knowledge-container">
        <div class="treeContent">
            <div class="header">
                <span>知识类目</span>
                <el-link type="primary" :underline="false" @click="importShow = !importShow">导入</el-link>
            </div>
            <knowledgeTree @getClassId="getClassId" type="class" ref="knowledgeTree"></knowledgeTree>
        </div>
        <div class="container calcwidth">
            <el-tabs v-model="activeName" v-show="typeName!='existAnswer'">
                <el-tab-pane label="FAQ问题管理" name="faqManage" v-if="menuAuthCodes.includes('M51')"></el-tab-pane>
            </el-tabs>
            <component :is="activeName" :classId="classId" v-on="$listeners"></component>
        </div>

        <!-- 分类导入 -->
        <import id="classImport" :importShow.sync="importShow" :importConfig="importConfig" @importSuccess="importSuccess" />
    </div>
</template>

<script>
import knowledgeTree from "@/components/knowledgeTree";
import Import from "@/components/Import";
import faqManage from "@/views/robotKnowledge/knowledge/faqManage";
import blank from "@/components/Blank";
export default {
    name: "MyKnowledge",
    data() {
        return {
            activeName: "faqManage",
            typeName: "familiarAnswer",
            answerPt: "padding-top: 60px;",
            answerZindex1: "z-index: 1;",
            answerZindex2: "z-index: 2; background-color: #FFFFFF;",
            classId: "0",
            importShow: false,
            importConfig: {
                css: {
                    "top": "50%",
                    "left": "50%",
                    "transform": "translate(-50%, -50%)"
                },
                title: "下载分类导入模板，根据模板的格式填写分类内容，填写完成后，一键导入",
                downloadUrl: "/static/download/知识分类导入模板.xlsx",
                importUrl: "/v1/admin/class/importClass",
            },
        };
    },
    created() {
        if (this.menuAuthCodes.includes('M51')) {
            this.activeName = "faqManage";
        } else {
            this.activeName = "blank";
        }
    },
    methods: {
        getClassId(classId) {
            this.classId = classId;
        },
        importSuccess() {
            this.$refs.knowledgeTree.getClassList();
        }
    },
    components: {
        knowledgeTree,
        faqManage,
        Import,
        blank
    },
};
</script>

<style lang="scss">
.MyKnowledge {
    padding-right: 10px;
    .answerType {
        position: absolute;
        margin-top: -60px;
        z-index: 1;
        .el-tabs__item {
            margin-right: 40px;
        }
    }
}
</style>